package chixing.day06.homework;

/**
 * public:用public修饰的属性，方法，类，其他类都能访问
 * private:用private修饰的属性，方法，类，只有该类才能访问
 * 用private提高了安全性，降低了耦合性
 * 提高安全性：元数据不被暴露在外
 * 降低耦合性：该类的属性只归本类自己管理（要修改时只在本类中修改就可以了）
 */
public class Student {
    private int stuId;
    private String stuName;
    private char stuGender;

    //省略了无参构造
    public Student(){}

    public Student(int stuId, String stuName, char stuGender) {
        this.stuId = stuId;
        this.stuName = stuName;
        this.stuGender = stuGender;
    }

    public void study(){
        System.out.println(this.stuName+" is studying...");
    }
    public void playGame(){
        System.out.println(this.stuName+" is playing game...");
    }

    public int getStuId() {
        return stuId;
    }

    public void setStuId(int stuId) {
        this.stuId = stuId;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public char getStuGender() {
        return stuGender;
    }

    public void setStuGender(char stuGender) {
        this.stuGender = stuGender;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuId=" + stuId +
                ", stuName='" + stuName + '\'' +
                ", stuGender=" + stuGender +
                '}';
    }
}
